Skip to content

Enhancements to CLI: AI Workflow Integration, Storage Options, and Bug Fixes#245

Merged
yangbobo2021 merged 21 commits into
mainfrom
chore/devchat-env-align
Feb 7, 2024
Merged

Enhancements to CLI: AI Workflow Integration, Storage Options, and Bug Fixes#245
yangbobo2021 merged 21 commits into
mainfrom
chore/devchat-env-align

Conversation

@yangbobo2021

Copy link
Copy Markdown
Contributor

This PR introduces a suite of improvements to the command-line interface, focusing on integrating AI-driven workflows, handling storage conditions for AI responses, improving error handling, and fixing bugs encountered with time mismatches and response settings.

Key Changes:

  • AI-driven workflow engine execution has been integrated with the addition of a command_runner.py module and enhancements to the engine initialization process.
  • A new route command has been added to enhance CLI interactions.
  • Conditional storage for AI responses is now implemented, allowing users to specify if responses should be preserved.
  • The error handling for OpenAI APIError has been improved to provide more explicit and user-friendly error messages.
  • Time mismatch bugs in OpenAI prompts and a timestamp-related crash have been addressed.
  • Command parsing has been made more robust with the inclusion of the origin path, making it compatible with Windows directory paths.

In addition to these features, several minor tweaks have been made, such as updating timeout values, introducing environment variables for managing cache directories, and ensuring non-storage response settings are handled appropriately.

These changes aim to enhance the user experience by making the CLI more reliable, versatile, and easy to use.

- Added path attribute to Command model for origin directory tracking
- Ensure directory paths are Windows compatible in command content
- Capture and store the command's origin file path in parsing process
- Add explicit handling for openai.APIError in CLI error handling
- Use logger to log the exception and echo error type to stderr
- Ensure a non-zero exit code on encountering openai.APIError
- Added command_runner.py with AI to auto-generate workflow parameters
- Implemented router.py to handle command routing and execution
- Enhanced engine init to include the new run_command function
- Introduced a flag to decide if AI responses should be stored
- Implemented conditional storage based on the new flag
- Refactored stream response handling to align with conditional storage
- Added datetime import to handle lack of timestamp in prompts
- Modified prompt formatting to prevent crash without hash
- Removed raising ValueError for missing timestamp and hash
- Removed redundant environment and parameter initializations.
- Centralized command execution error handling and environment management.
- Enhanced readability and maintainability by isolating LLM function call logic.
- Removed auto selection logic for workflow execution
- Shifted the selection logic to be managed by workflows externally
- Cleaned up redundant codes and streamlined command processing flow
- Moved __make_function and __select_function_by_llm to ToolUtil class
- Introduced CommandUtil and ToolUtil classes in util.py
- Slimmed down command_runner.py by abstracting utility functions
- Removed unused `openai` import in command_runner.py
- Adjusted spacing for readability and compliance with PEP8
- Enforced method signature alignment in util.py for better readability
- Introduced MissContentInPromptException for better error messages
- Refactored before_prompt to improve readability and modularity
- Enhanced workflow prompt processing with new loading function
- Removed redundant error logging to stderr
- Ensured model_name, parent_hash, and history_messages are non-empty
- Updated environment variable handling for better robustness
- Implemented auto-copy of devchat dependency packages to the tools directory for local package environment verification.
- Updated dependencies in poetry.lock to include new versions and additional packages such as tenacity, pathspec, and importlib-resources.
- Modified pyproject.toml to reflect the updated version of pydantic and added new dependencies for better environment verification support.
@yangbobo2021 yangbobo2021 merged commit 51e9d50 into main Feb 7, 2024
@yangbobo2021 yangbobo2021 deleted the chore/devchat-env-align branch February 7, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant